package com.tul.exercise.base.innerclass.chapter10_6;


/**
 * @Description 《java编程思想》10.6 示例 1
 *  匿名类方法参数必须是final
 **/
public class Parel10 {

    public Destination destincation(final String dest, final float price) {
        return new Destination() {
            private int cost;

            {
                cost = Math.round(price);
                if (cost > 100) {
                    System.out.println("Over budget!");
                }


            }

            private String label = dest;

            public String readLabel() {
                return label;
            }
        };


    }

    public static void main(String[] args) {
        Parel10 p = new Parel10();
        Destination d = p.destincation("Wuhan", 101.396F);

    }

}

